package com.wj.jiangan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wj.jiangan.mapper.PartMapper;
import com.wj.jiangan.pojo.Client;
import com.wj.jiangan.pojo.Part;
import com.wj.jiangan.pojo.ext.PartExt;
import com.wj.jiangan.service.IPartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wj
 * @since 2019-11-05
 */
@Service
public class PartServiceImpl implements IPartService {

    @Autowired
    private PartMapper partMapper;

    @Override
    public void deletePart(Integer id) {
        partMapper.deleteById(id);
    }

    @Override
    public List<Part> queryPartByPIs(Map map) {

        return partMapper.selectByMap(map);
    }

    @Override
    public IPage<Part> findPartByPage(Page<Part> page) {
        QueryWrapper<Part> part = new QueryWrapper<>();
        return partMapper.selectPage(page, part);
    }


    @Override
    public List<Part> findPartQueryById() {

        return partMapper.findAllPartQueryById();
    }

    @Override
    public List<PartExt> departmentPerformancePie() {
        return partMapper.departmentPerformancePie();
    }

    @Override
    public List<Part> queryAllPart() {
        return partMapper.selectList(null);
    }

    @Override
    public void save(Part part) {
        partMapper.insert(part);
    }

    @Override
    public void updatePartIS(Part part, QueryWrapper queryWrapper) {
        partMapper.update(part, queryWrapper);
    }

    @Override
    public void updatePartByPPId(Part part) {
        partMapper.updateById(part);
    }

    @Override
    public List<Part> queryPartByPId(QueryWrapper queryWrapper) {
        return partMapper.selectList(queryWrapper);
    }

    @Override
    public List<Part> queryPartByName(QueryWrapper queryWrapper) {
        return partMapper.selectList(queryWrapper);
    }

    @Override
    public List<Part> searchPart(QueryWrapper queryWrapper) {
        return partMapper.selectList(queryWrapper);
    }

    @Override
    public IPage queryInPage(Page page, QueryWrapper queryWrapper) {
        return partMapper.selectPage(page, queryWrapper);

    }
}
